<script setup lang="ts">
import {useUserPinia} from '~/stores/user'
import {storeToRefs} from "pinia";
import {onMounted, ref, onBeforeMount} from "vue";
import Player from "xgplayer";

import HP5050 from "~/public/shop/HP5050_banner-Lido_03_Ivory_Boucle_1011-992x1120_672x448.webp"
// 用tm代替t，因为tm是响应式的而且可以解析对象
const {locale, setLocale, tm} = useI18n()
const userStore = useUserPinia()
const {token, rating_five} = storeToRefs(userStore);

import "xgplayer/dist/index.min.css";



const online_list1 = ref([
    {
      id: "1",
      title: '强大的代扣渠道覆盖',
      subTitle: "除了传统的银行卡代扣，我们支持数十种亚洲主流数字支付方式，覆盖超过10亿数字支付用户。",
      src: 'https://cdn.marmot-cloud.com/page/antom_official_website/_next/static/media/mutil-icon-terminal.49e4d8e0.svg'
    },
    { 
      id: "2",
      title: '省心的支付信息维护',
      subTitle: "只需一次签约绑定，顾客的支付令牌信可长期有效并自动更新。",
      src: 'https://cdn.marmot-cloud.com/page/antom_official_website/_next/static/media/mutil-icon-cost.696937bd.svg'
    },
    { 
      id: "3",
      title: '兼顾安全性与便捷',
      subTitle: "蚂蚁风控科技为交易安全保驾护航，保障用户信息的隐私安全、减少支付流程的身份核验干扰。",
      src: 'https://cdn.marmot-cloud.com/page/antom_official_website/_next/static/media/mutil-icon-cost.696937bd.svg'
    }
 ])

 const pay_list = ref([
    {
      id: "1",
      title: '电子钱包',
      src: 'https://mdn.alipayobjects.com/huamei_pwpjvv/afts/img/A*EsWMS5EnjdEAAAAAAAAAAAAADmesAQ/fmt.webp'
    },
    { 
      id: "2",
      title: '在线网银',
      src: 'https://mdn.alipayobjects.com/huamei_pwpjvv/afts/img/A*l3UtRLZB8zIAAAAAAAAAAAAADmesAQ/fmt.webp'
    },
    { 
      id: "3",
      title: '银行卡',
      src: 'https://mdn.alipayobjects.com/huamei_pwpjvv/afts/img/A*62f2QLWkrL8AAAAAAAAAAAAADmesAQ/fmt.webp'
    },
    { 
      id: "4",
      title: '柜台支付',
      src: 'https://mdn.alipayobjects.com/huamei_pwpjvv/afts/img/A*2FqQQrujwSIAAAAAAAAAAAAADmesAQ/fmt.webp'
    },
    { 
      id: "5",
      title: '国家网关',
      src: 'https://mdn.alipayobjects.com/huamei_pwpjvv/afts/img/A*fsElSYqy7HYAAAAAAAAAAAAADmesAQ/fmt.webp'
    },
 ])

 const multiport_list = ref([
    {
      id: "1",
      title: '手机',
      src: 'https://cdn.marmot-cloud.com/page/antom_official_website/_next/static/media/cashier-icon-mobile.2787f257.svg'
    },
    { 
      id: "2",
      title: 'PC和平板',
      src: 'https://cdn.marmot-cloud.com/page/antom_official_website/_next/static/media/cashier-icon-pc.f325d1fc.svg'
    },
    { 
      id: "3",
      title: '电视',
      src: 'https://cdn.marmot-cloud.com/page/antom_official_website/_next/static/media/cashier-icon-tv.758e2233.svg'
    },
 ])

 const integration_list = ref([
 {
      id: "1",
      title: 'API模式',
      subTitle: '100%定制化的收银台方案，收银样式完全由您决定。',
      src: 'https://cdn.marmot-cloud.com/page/antom_official_website/_next/static/media/cashier-icon-api.a2491b4d.svg'
    },
    { 
      id: "2",
      title: 'SDK模式',
      subTitle: '在我们提供的收银台模块基础上，灵活调试页面风格，适配您的业务需求。',
      src: 'https://cdn.marmot-cloud.com/page/antom_official_website/_next/static/media/cashier-icon-sdk.38c81779.svg'
    },
 ])

 let player = ref({})

/**
 * 屏幕尺寸
 */
const screenSize = ref({width: 0, height: 0});


// 更新屏幕尺寸的方法
const updateScreenSize = () => {
  screenSize.value = {
    width: window.innerWidth,
    height: window.innerHeight,
  };
  // console.log("屏幕尺寸", screenSize.value.width)
};


onMounted(() => {
  window.addEventListener('resize', updateScreenSize);
  // 初始化屏幕尺寸
  updateScreenSize();

  player.value = new Player({
    id: "mse", //元素id
    lang: "zh", //设置中文
    volume: 0, // 默认静音
    autoplay: true, //自动播放
    screenShot: false, // 开启截图功能
    loop: true,
    fullscreen: true,
    //视频地址
    url: 'https://gw.alipayobjects.com/v/huamei_pwpjvv/afts/video/A*9MiGSZ_aE_sAAAAAAAAAAAAADmesAQ',

    //封面图
    poster:
        'https://gw.alipayobjects.com/v/huamei_pwpjvv/afts/video/A*vHOkTY_p9EYAAAAAAAAAAAAADmesAQ',
    fluid: true, // 填满屏幕 （流式布局）
    playbackRate: [0.5, 0.75, 1, 1.5, 2] //传入倍速可选数组
  });
})

// 组件卸载时移除事件监听器
onUnmounted(() => {
  window.removeEventListener('resize', updateScreenSize);
});

const carousel_Images = computed(() => {
  return [
    {
        headImage: 'https://mdn.alipayobjects.com/huamei_pwpjvv/afts/img/A*uWDfQKI7mRgAAAAAAAAAAAAADmesAQ/fmt.webp',
        subImage: 'https://mdn.alipayobjects.com/huamei_pwpjvv/afts/img/A*OL3XTJWmJlEAAAAAAAAAAAAADmesAQ/fmt.webp'
    }
  ]
})

</script>

<template>
  <v-app>
    <!-- 主图-->
    <banner-main
      :lists="carousel_Images"
      :lists_bottom="online_list1"
      title="代扣" 
      subTitle="基于令牌的授权支付可以为顾客提供丝滑的免密支付体验。调用接口直接扣款，使支付成功率提升多达20%，同时避免反复核验身份，提高顾客在平台的复购率。"
     ></banner-main>
     
    <div class="w-full bg-[#f0f0f0] p-40 mt-40">
      <div class="d-flex flex-column justify-center align-center mb-20">
        <span class="font-semibold text-3xl mb-10">消除交易摩擦</span>
        <span>无打扰的支付体验支持手机、电脑、电视等多类终端，兼容各类代扣场景。</span>
      </div>

      <div class="mx-auto w-9/12">
          <div id="mse"></div>
      </div>
    </div>

    <footer-other></footer-other>

  </v-app>

</template>

<style scoped>
    :deep(.xgplayer-controls.controls-autohide) {
      display: none;
    }
    :deep(video) {
        width: 100%;
        height: 100%;
        object-fit: fill; /* 或者使用 contain，根据需求选择 */
    }
</style>